﻿@model IEnumerable<QuanLyCayXanh.Models.FamilyTree>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Content</h2>
<p>
    @Html.ActionLink("Tạo dòng họ cây", "Create", null, new { @class = "pure-button" })
</p>

<table class="pure-table pure-table-bordered">
    <thead>
        <tr>
            <th>STT</th>
            <th>@Html.DisplayNameFor(model => model.Name)</th>
            <th>@Html.DisplayNameFor(model => model.Code)</th>
            <th>@Html.DisplayNameFor(model => model.Image)</th>
            <th>@Html.DisplayNameFor(model => model.Color)</th>
            <th>@Html.DisplayNameFor(model => model.Description)</th>
            <th>@Html.DisplayNameFor(model => model.Information)</th>
            <th>Hành Động</th>
        </tr>
    </thead>
    @{ 
        int count = 0;
    
    }
    @foreach (var item in Model)
    {

    count = count + 1;
    string trClass = count % 2 == 1 ? "" : "pure-table-odd";

    <tr class="@trClass">
        <td>@count</td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Code)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Image)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Color)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Information)
        </td>
        <td>
            <a class="pure-button" href="@Url.Action("Edit", new { id = item.Id })">
                <i class="fa fa-edit"></i>
            </a>
            <a class="pure-button detail-link" href="@Url.Action("Details", new { id = item.Id })">
                <i class="fa fa-angle-down"></i>
            </a>
            <a class="pure-button delete-link" name="@item.Name" href="@Url.Action("Delete", new { id = item.Id })">
                <i class="fa fa-remove"></i>
            </a>
            @*@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }, new { @class = "detail-link" }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "delete-link", name = item.Name })*@
        </td>
    </tr>
}
</table>

@Html.Partial("~/Views/Shared/_ActionForm.cshtml")